home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / math / graphs / graphed-.1 / graphed- / usr / local / graphed / include / sgraph / sgraph_interface.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-10  |  4.4 KB  |  230 lines

  1. /* (C) Universitaet Passau 1986-1994 */
  2. /* Sgraph Source, 1988-1994 by Michael Himsolt */
  3.  
  4. #ifndef SGRAPH_INTERFACE_H
  5. #define SGRAPH_INTERFACE_H
  6.  
  7. #include <sgraph/sgraph.h>
  8. #include <sgraph/graphed_structures.h>
  9. #ifndef EXTERN_LINK_MODULE
  10. #include  <graphed/user_event_functions.h>
  11. #endif
  12.  
  13. extern    void    menu_call_sgraph_proc (); /* Menu, Menu_item, (void*)() */
  14. extern    void    call_sgraph_proc(void (*proc) (), char *user_args);
  15. extern    void    call_sgraphs_proc (Slist (*proc) (), char *user_args);
  16.  
  17.  
  18. typedef    enum    {
  19.     SGRAPH_SELECTED_NONE,
  20.     SGRAPH_SELECTED_NOTHING,
  21.     SGRAPH_SELECTED_SNODE,
  22.     SGRAPH_SELECTED_SEDGE,
  23.     SGRAPH_SELECTED_GROUP,
  24.     
  25.     SGRAPH_SELECTED_SAME
  26. }
  27.     Sgraph_selected;
  28.  
  29.  
  30. typedef    union {
  31.     Snode    snode;
  32.     Sedge    sedge;
  33.     Slist    group;
  34. }
  35.     Sgraph_selection;
  36.  
  37.  
  38. typedef struct sgraph_proc_info {
  39.     
  40.     Sgraph_selected  selected;
  41.     Sgraph           sgraph;
  42.     Sgraph_selection selection;
  43.     int              buffer;
  44.     
  45.     Sgraph_selected  new_selected;
  46.     Sgraph           new_sgraph;
  47.     Sgraph_selection new_selection;
  48.     int              new_buffer;
  49.     
  50.     int    repaint,
  51.         recompute,
  52.         no_changes,
  53.         no_structure_changes,
  54.         save_selection;
  55.     
  56.     int    recenter;
  57. }
  58.     *Sgraph_proc_info;
  59.  
  60. #define    NEW_SEDGE    NEW_EDGE
  61. #define    OLD_SEDGE_REAL_POINT    OLD_EDGE_REAL_POINT
  62. #define    OLD_SEDGE_IMAGINARY_POINT    OLD_EDGE_IMAGINARY_POINT
  63. #define    MOVE_SNODE    MOVE_NODE
  64. #define    SCALE_SNODE_MIDDLE    SCALE_NODE_MIDDLE
  65. #define    SCALE_SNODE_UPPER_LEFT    SCALE_NODE_UPPER_LEFT
  66. #define    SCALE_SNODE_UPPER_RIGHT    SCALE_NODE_UPPER_RIGHT
  67. #define    SCALE_SNODE_LOWER_LEFT    SCALE_NODE_LOWER_LEFT
  68. #define    SCALE_SNODE_LOWER_RIGHT    SCALE_NODE_LOWER_RIGHT
  69.  
  70. /************** Extended Application Interface **************************/
  71.  
  72.  
  73. typedef    struct    {
  74.  
  75.     Edge_drag_info    what;
  76.         
  77.     union {
  78.         struct {
  79.             Snode        source;
  80.             Edgeline    el;
  81.         }
  82.             new_edge;
  83.         struct {
  84.             Sedge        edge;
  85.             Edgeline    el;
  86.         }
  87.             real_point;
  88.         struct {
  89.             Sedge        edge;
  90.             Edgeline    el;
  91.         }
  92.             imaginary_point;
  93.     }
  94.         which;
  95.         
  96.     int    x,y;
  97. }
  98.     Sgraph_drag_edge_info;
  99.  
  100.  
  101. typedef    struct    {
  102.     Node_drag_info what;
  103.         
  104.     Snode    node;
  105.     
  106.     int    x,y, sx,sy;    /* Platzierung und Groesse    */
  107.     
  108.     int    correction_x,    /* Korrekturen, da Klickpunkt    */
  109.         correction_y;    /* nicht immer der Knoten-    */
  110.                 /* mittelpunkt ist.        */
  111. }
  112.     Sgraph_drag_node_info;
  113.  
  114.  
  115.  
  116. typedef    struct    {
  117.     Slist    group;    /* DIE Gruppe            */
  118.     int    x ,y,    /* Position von group->node    */
  119.         x0,y0;    /* Ursprungsposition        */
  120.     int    correction_x,    /* siehe Drag_node_info    */
  121.         correction_y;
  122. }
  123.     Sgraph_drag_group_info;
  124.  
  125.  
  126. typedef    struct    {
  127.     int    x1,y1,    /* Linke obere Ecke        */
  128.         x2,y2;    /* Rechte untere Ecke        */
  129.     int    shift_is_down;
  130. }
  131.     Sgraph_drag_box_info;
  132.  
  133.  
  134. typedef    struct    {
  135.     int              x,y;        /* Rechte untere Ecke    */
  136.     Sgraph_selected  what;
  137.     Sgraph_selection which;
  138. }
  139.     Sgraph_click_info;
  140.  
  141.  
  142. #define Sgraph_uev_state User_event_functions_state
  143. #define SGRAPH_UEV_START UEV_START
  144. #define SGRAPH_UEV_DRAG UEV_DRAG
  145. #define SGRAPH_UEV_INTERMEDIATE_STOP UEV_INTERMEDIATE_STOP
  146. #define SGRAPH_UEV_FINISH UEV_FINISH
  147. #define SGRAPH_UEV_ERROR UEV_ERROR
  148.  
  149. #define Sgraph_uev_type User_event_functions_type
  150. #define SGRAPH_UEV_CLICK UEV_CLICK
  151. #define SGRAPH_UEV_DOUBLE_CLICK UEV_DOUBLE_CLICK
  152. #define SGRAPH_UEV_DRAG_NODE UEV_DRAG_NODE
  153. #define SGRAPH_UEV_DRAG_EDGE UEV_DRAG_EDGE
  154. #define SGRAPH_UEV_DRAG_GROUP UEV_DRAG_GROUP
  155. #define SGRAPH_UEV_DRAG_BOX UEV_DRAG_BOX
  156. #define NUMBER_OF_SGRAPH_UEV_FUNCTIONS NUMBER_OF_UEV_FUNCTIONS
  157.  
  158. typedef    struct    sgraph_event_proc_info {
  159.     
  160.     Sgraph_uev_state    state;
  161.     Sgraph_uev_type        type;
  162.  
  163.     union {
  164.         Sgraph_click_info    click;
  165.         Sgraph_drag_node_info    node;
  166.         Sgraph_drag_edge_info    edge;
  167.         Sgraph_drag_group_info    group;
  168.         Sgraph_drag_box_info    box;
  169.     }
  170.         details;
  171.     
  172.     int    do_default_action;
  173. }
  174.     *Sgraph_event_proc_info;
  175.  
  176.  
  177. typedef    struct    sgraph_command_proc_info {
  178.     
  179.     User_action    action;
  180.     
  181.     union {
  182.         Sgraph    sgraph;
  183.         Snode    snode;
  184.         Sedge    sedge;
  185.     }
  186.         data;
  187.     
  188. }
  189.     *Sgraph_command_proc_info;
  190.  
  191.  
  192.  
  193. /****************** Multiple Graphs Interface ****************************/
  194.  
  195.  
  196. typedef    enum    {
  197.     SIMPLE_SGRAPH_PROC,
  198.     SGRAPH_EVENT_PROC
  199. }
  200.     Sgraph_proc_type;
  201.     
  202.  
  203.  
  204. typedef    struct    call_sgraph_proc_info {
  205.     
  206.     int    x_center_before, y_center_before;
  207.     int    n_nodes;
  208.  
  209.     struct    sgraph_proc_info     sgraph_proc_info;
  210.     struct    sgraph_event_proc_info    sgraph_event_proc_info;
  211.     
  212.     int    structure_changed, anything_changed;
  213. }
  214.     *Call_sgraph_proc_info;
  215.  
  216.  
  217. typedef struct sgraph_selection_info {
  218.  
  219.     Sgraph_selected        selected;
  220.     Sgraph_selection    selection;
  221.     int            save_selection;
  222.  
  223. }
  224.     *Sgraph_selection_info;
  225.  
  226. extern Snode sedge_real_source();
  227. extern Snode sedge_real_target();
  228.  
  229. #endif
  230.